-- @owner: @l3007kkk
-- @date: 2025/08/05
-- @testpoint:事务回滚前后使用函数@@rowcount

--连接D库
@conn PrimaryDbDmode;
--创建插件
--create extension shark;
--step1:建表;expect:成功
drop table if exists t_rowcount_0018_01;
create table t_rowcount_0018_01(id int,name varchar(10));

--step2:insert后查询, 返回3;expect:成功
BEGIN;
insert into t_rowcount_0018_01 values(1,'zhangsan'),(2,'lisi'),(3,'wangwu');
SELECT @@ROWCOUNT;
ROLLBACK;

--step3:rollback后查询, 返回0;expect:成功
BEGIN ;
insert into t_rowcount_0018_01 values(1,'zhangsan'),(2,'lisi'),(3,'wangwu');
ROLLBACK;
SELECT @@ROWCOUNT;

--step4:commit后查询, 返回0;expect:成功
BEGIN ;
insert into t_rowcount_0018_01 values(1,'zhangsan'),(2,'lisi'),(3,'wangwu');
commit;
SELECT @@ROWCOUNT;

--step5:清理环境;expect:成功
drop table if exists t_rowcount_0018_01;
